package com.mmc.delay.api.impl;

import com.mmc.delay.api.PartitionService;
import com.mmc.delay.config.DelayCoreConfig;

import java.util.Random;

public class RandomPartitionService implements PartitionService {

    @Override
    public String partition(String name) {
        Integer partitionCount = DelayCoreConfig.getPartitionCount();
        Integer partition=new Random().nextInt(50)%partitionCount+1;
        return partition.toString();
    }
}
